Telegram Group & Telegram Channel
Assert

Если выполнить инструкцию assert с логическим выражением, результат которого равен True, ничего не произойдет. Но если попробовать выполнить инструкцию assert с логическим выражением, которое равно False, то будет сгенерировано исключение AssertionError.

Исключения AssertionError предназначены скорее для программистов. При написании программ на этапе разработки мы должны видеть, что делаем что-то не так (к примеру, передали в функцию некорректное значение).

Не нужно, например, обрабатывать пользовательский ввод и пытаться обработать исключение AssertionError блоком try except. Если таких мест будет очень много, то это затронет и производительность программы.

#исключения #assert



tg-me.com/python_academy/245
Create:
Last Update:

Assert

Если выполнить инструкцию assert с логическим выражением, результат которого равен True, ничего не произойдет. Но если попробовать выполнить инструкцию assert с логическим выражением, которое равно False, то будет сгенерировано исключение AssertionError.

Исключения AssertionError предназначены скорее для программистов. При написании программ на этапе разработки мы должны видеть, что делаем что-то не так (к примеру, передали в функцию некорректное значение).

Не нужно, например, обрабатывать пользовательский ввод и пытаться обработать исключение AssertionError блоком try except. Если таких мест будет очень много, то это затронет и производительность программы.

#исключения #assert

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/245

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

A Telegram spokesman declined to comment on the bond issue or the amount of the debt the company has due. The spokesman said Telegram’s equipment and bandwidth costs are growing because it has consistently posted more than 40% year-to-year growth in users.

Telegram and Signal Havens for Right-Wing Extremists

Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.

Python Academy from de


Telegram Python Academy
FROM USA